package com.junzhiit.nengji.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum IsFreeCarriage {
	UNCARRIAGE(0,"不包邮"),
	CARRIAGE(1,"包邮");
	
	private Integer status;
	
	private String value;

	private IsFreeCarriage(Integer status,String value){
		this.status = status;
		this.value = value;
	}

	public int toIntStatus() {
		return this.status;
	}
	
	public String toStringValue() {
		return this.value;
	}

	public static IsFreeCarriage toStatus(int status) {
		if (UNCARRIAGE.status == status) {
			return UNCARRIAGE;
		} else if (CARRIAGE.status == status) {
			return CARRIAGE;
		} else {
			throw new InvalidArgumentException("Unknown status[" + status + "].");
		}
	}
}
